<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<body>
<style type="text/css">
	#tbClassHome{
		padding: 15px;
		background: #fff;
		border-radius: 10px;
	}
	.layui-inline{
		width:45%;
	}
	.layui-input-block{
		margin-left: 135px;
	}
	.layui-form-label{
		width: 100px;
	}
</style>
<div id="tbClassHome">
	<fieldset class="layui-elem-field layui-field-title site-title">
		<legend><a name="fixbar">${model.name}</a></legend>
	</fieldset>
	<form class="layui-form" action="save" method="post" lay-filter="stuform">
		<div class="layui-tab">
		  	<ul class="layui-tab-title">
			    <li class="layui-this">基本信息</li>
			    <li>班级成员</li>
			    <li>课表</li>
			    <li>班委会成员</li>
		  	</ul>
		  	<div class="layui-tab-content">
			    <div class="layui-tab-item layui-show" style="margin-top: 20px;">
				     <div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">班级</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" name="name" value="${model.name}">
							</div>
						</div>
						<div class="layui-inline"> 
							<label class="layui-form-label">培训主题</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" name="subject" value="${model.subject}">
							</div>
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">班级类型</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" name="subject" value="${model.ctype.type}">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">班级人数</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" name="classSize" value="${model.classSize}">
							</div>
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">报名开始时间</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" id="regBeginTime" name="regBeginTime" value="${model.regBeginTime}">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">报名结束时间</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" id="regEndTime" name="regEndTime" value="${model.regEndTime}">
							</div>
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">开班日期</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" id="startTime" name="startTime" value="${model.startTime}">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">结业日期</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" id="closeTime" name="closeTime" value="${model.closeTime}">
							</div>
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">班级状态</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" id="closeTime" name="closeTime" value="${model.classStatus.state}">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">备注</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" name="memo" value="${model.memo}">
							</div>
						</div>
					</div>
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">辅导员</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" id="startTime" name="instructor.id" value="${model.instructor.name}">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">后勤服务员</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" id="closeTime" name="logistics" value="${model.logistics.name}">
							</div>
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">辅导员</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" id="closeTime" name="logistics" value="${model.teacherId.name}">
							</div>
						</div>
					</div>
			    </div>
			    <div class="layui-tab-item">
					<table id="student_table"></table>
				</div>
			    <div class="layui-tab-item">
					<table class="layui-table" lay-size="sm">
						<thead>
							<tr>
								<th>日期</th>
								<th colspan="2">时间</th>
								<th>课程</th>
								<th>主讲人</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${model1}" var="c">
								<c:if test="${c.background }">
									<tr style="background: #c9e3d6;">
										<c:if test="${c.datatr!=0 }">
											<td rowspan="${c.datatr }">${c.data }</td>
										</c:if>
										<c:if test="${c.daytr!=0 }">
											<td rowspan="${c.daytr }">${c.day }</td>
										</c:if>
										<c:if test="${c.timetr!=0 }">
											<td rowspan="${c.timetr }">${c.time }</td>
										</c:if>
										<td>${c.kc }</td>
										<td>${c.teachername }</td>
									</tr>
								</c:if>
								<c:if test="${!c.background }">
									<tr>
										<c:if test="${c.datatr!=0 }">
											<td rowspan="${c.datatr }">${c.data }</td>
										</c:if>
										<c:if test="${c.daytr!=0 }">
											<td rowspan="${c.daytr }">${c.day }</td>
										</c:if>
										<c:if test="${c.timetr!=0 }">
											<td rowspan="${c.timetr }">${c.time }</td>
										</c:if>
										<td>${c.kc }</td>
										<td>${c.teachername }</td>
									</tr>
								</c:if>
								
									
							</c:forEach>
						</tbody>
					</table>
				</div>
			    <div class="layui-tab-item">
					<table id="committee_table"></table>
				</div>
		  	</div>
		</div>
	</form>
</div>
<script type="text/javascript">
	layui.use('element', function(){
	  	var element = layui.element;
	});
	
	layui.use("table", function(){
		var table = layui.table;
		table.render({
			elem: '#student_table',
			url: '${pageContext.request.contextPath }/student/page2',
			where: {tbClassid: '${model.id}'},
			title: '班级成员',
			height: 'full-390',
			page: true,
			cols: [ [
				{field: 'name', title: '姓名'},
				{field: 'sex', title: '性别'},
				{field: 'workUnit', title: '工作单位'},
				{field: 'job', title: '职务'},
				{field: 'phone', title: '电话'}
			] ]
		});
		
		table.render({
			elem: '#committee_table',
			url: '${pageContext.request.contextPath }/committee/page',
			where: {bjid: '${model.id}'},
			title: '班委会成员',
			height: 'full-390',
			page: true,
			cols: [ [
				{
					field : 'student',
					title : '姓名',
					templet : function(d) {
						return d.student ? d.student.name : '';
					}
				}, {
					field : 'student',
					title : '电话',
					templet : function(d) {
						return d.student ? d.student.phone : '';
					}
				}, {
					field : 'position',
					title : '职务'
				}
			] ]
		});
	});
</script>
</body>
